GSourceFunc callback,
gpointer user_data);
-static gboolean is_modally_blocked (GdkWindow *window);
-
/* Private variable declarations
*/
return_val = TRUE;
}
- tmp = _gdk_modal_current ();
-
- if (tmp != NULL)
+ if (_gdk_modal_blocked (gdk_window_get_toplevel (window)))
{
- if (gdk_window_get_toplevel (window) != tmp)
- {
- *ret_valp = MA_NOACTIVATEANDEAT;
- return_val = TRUE;
- }
+ *ret_valp = MA_NOACTIVATEANDEAT;
+ return_val = TRUE;
}
}
* but we still need to deal with alt-tab, or with SetActiveWindow() type
* situations.
*/
- if (is_modally_blocked (window) && LOWORD (msg->wParam) == WA_ACTIVE)
+ if (_gdk_modal_blocked (window) && LOWORD (msg->wParam) == WA_ACTIVE)
{
GdkWindow *modal_current = _gdk_modal_current ();
SetActiveWindow (GDK_WINDOW_HWND (modal_current));
{
modal_win32_dialog = window;
}
-
-static gboolean
-is_modally_blocked (GdkWindow *window)
-{
- GdkWindow *modal_current = _gdk_modal_current ();
- return modal_current != NULL ? gdk_window_get_toplevel (window) != modal_current : FALSE;
-}
void _gdk_push_modal_window (GdkWindow *window);
void _gdk_remove_modal_window (GdkWindow *window);
GdkWindow *_gdk_modal_current (void);
-
+gboolean _gdk_modal_blocked (GdkWindow *window);
#ifdef G_ENABLE_DEBUG
gchar *_gdk_win32_color_to_string (const GdkColor *color);
}
}
-GdkWindow *
-_gdk_modal_current (void)
+gboolean
+_gdk_modal_blocked (GdkWindow *window)
{
- if (modal_window_stack != NULL)
+ GSList *l;
+ gboolean found_any = FALSE;
+
+ for (l = modal_window_stack; l != NULL; l = l->next)
{
- GSList *tmp = modal_window_stack;
+ GdkWindow *modal = l->data;
- while (tmp != NULL && !GDK_WINDOW_IS_MAPPED (GDK_WINDOW (tmp->data)))
- {
- tmp = g_slist_next (tmp);
- }
+ if (modal == window)
+ return FALSE;
- return tmp != NULL ? tmp->data : NULL;
+ if (GDK_WINDOW_IS_MAPPED (modal))
+ found_any = TRUE;
}
- else
+
+ return found_any;
+}
+
+GdkWindow *
+_gdk_modal_current (void)
+{
+ GSList *l;
+
+ for (l = modal_window_stack; l != NULL; l = l->next)
{
- return NULL;
+ GdkWindow *modal = l->data;
+
+ if (GDK_WINDOW_IS_MAPPED (modal))
+ return modal;
}
+
+ return NULL;
}
static void